﻿<UserControl x:Class="MediaOwl.WebSearch.Views.BingTranslationView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
             xmlns:cal="http://www.caliburnproject.org"
             xmlns:ctrl="clr-namespace:MediaOwl.Common.ControlTemplates;assembly=MediaOwl.Common"
             mc:Ignorable="d"
             d:DesignHeight="569"
             d:DesignWidth="833">
	<UserControl.Resources>
		<DataTemplate x:Key="DictionaryValueDataTemplate">
			<TextBlock TextWrapping="Wrap" Text="{Binding Value}" d:LayoutOverrides="HorizontalAlignment" Margin="10,0"/>
		</DataTemplate>
	</UserControl.Resources>

    <ctrl:WorkitemControl BusyContext="{Binding CurrentBusyViewModel}"
                          DialogContext="{Binding ActiveDialog}">
    	<i:Interaction.Triggers>
    		<i:EventTrigger>
    			<cal:ActionMessage MethodName="GetAvailableLanguages"/>
    		</i:EventTrigger>
    	</i:Interaction.Triggers>
        <toolkit:DockPanel Margin="5">

            <TextBlock x:Name="DisplayName"
        		TextWrapping="Wrap"
        		toolkit:DockPanel.Dock="Top"
        		Style="{StaticResource Heading2}"
        		Margin="0,0,0,10" />

        	<toolkit:DockPanel LastChildFill="False"
        		Margin="0,0,0,5">
        		<toolkit:DockPanel toolkit:DockPanel.Dock="Top">
        			<TextBox x:Name="TextToTranslate"
        				TextWrapping="Wrap"
        				MinWidth="300"
        				d:LayoutOverrides="Height">
        				<i:Interaction.Triggers>
        					<ei:KeyTrigger Key="Enter">
        						<cal:ActionMessage MethodName="TranslateShortCut" />
        					</ei:KeyTrigger>
        				</i:Interaction.Triggers>
        			</TextBox>
        			<Button x:Name="TranslateText"
        				Content="Translate"
        				d:LayoutOverrides="Height" Margin="10,0,0,0" />
        		</toolkit:DockPanel>
        		<Grid toolkit:DockPanel.Dock="Top" Margin="0,10,0,0">
        			<Grid.RowDefinitions>
        				<RowDefinition Height="Auto"/>
        				<RowDefinition/>
        			</Grid.RowDefinitions>
        			<Grid.ColumnDefinitions>
        				<ColumnDefinition/>
        				<ColumnDefinition/>
        			</Grid.ColumnDefinitions>
        			<TextBlock Text="Source Language" Style="{StaticResource Heading5}" Margin="2"/>
        			<ListBox Grid.Row="1" SelectedValuePath="Key" ItemTemplate="{StaticResource DictionaryValueDataTemplate}" ItemsSource="{Binding AvailableLanguages}" Margin="0,0,2,0" SelectedValue="{Binding SelectedSourceLanguage, Mode=TwoWay}"/>
        			<TextBlock Text="Target Language" Grid.Column="1" Style="{StaticResource Heading5}" Margin="2"/>
        			<ListBox Grid.Row="1" Grid.Column="1" SelectedValuePath="Key" ItemTemplate="{StaticResource DictionaryValueDataTemplate}" ItemsSource="{Binding AvailableLanguages}" Margin="2,0,0,0" SelectedValue="{Binding SelectedTargetLanguage, Mode=TwoWay}"/>
        		</Grid>
        	</toolkit:DockPanel>
        	<toolkit:DockPanel>
        		<Button x:Name="Speak"
        			Content="Speak"
        			Margin="10,0" HorizontalAlignment="Right" toolkit:DockPanel.Dock="Top"/>
        		<Border
        			toolkit:DockPanel.Dock="Bottom"
        			Margin="10"
        			MinHeight="20" BorderThickness="2" Background="{StaticResource ReadOnlyBrush}" BorderBrush="{StaticResource DarkBorder}"
        		>
        			<ScrollViewer Margin="5" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" BorderBrush="Transparent" >
        				<TextBlock x:Name="Translation"
        					Foreground="{StaticResource Heading1FontBrush}" FontSize="16" />
        			</ScrollViewer>
        		</Border>
        	</toolkit:DockPanel>
        </toolkit:DockPanel>
    </ctrl:WorkitemControl>
</UserControl>
